/*
 * CommandsTextFileParser.h
 *
 *  Created on: Dec 12, 2014
 *      Authors: Avihay Avitan & Stefan Farcas
 */

#ifndef COMMANDSTEXTFILEPARSER_H_
#define COMMANDSTEXTFILEPARSER_H_
#include "../Pass/PassVector.h"
#include "../FileFormat/CommandsFileTextFormat.h"

#include "ITextFileParser.h"
using namespace std;
using namespace SatelliteNameSpace ;
using namespace LoggerNameSpace;

using namespace PassVectorSpace;

namespace TextFileParserSpace {

/**
 * CommandsTextFileParser implements the ITextFileParser for parsing the commands text file
 */
class CommandsTextFileParser: public ITextFileParser {
public:
	CommandsTextFileParser();
	virtual ~CommandsTextFileParser();
	bool setTextFileToParse(string fileNameWithFullPath);
	bool setFileTextFormat(IFileFormat * fileFormat);
	bool parseFile();
	vector<SatelliteUplinkCommand * > * getParsedCommandsVectors();


private:
	int satIndex;
	int countLoaded;
	string tmpSatId;
	SatelliteUplinkCommand tmpCmd;
	vector<SatelliteUplinkCommand * > parsedCommands[3];
	bool loadParsedSatId(string line);
	bool loadParsedCommand(string line);
	bool isEndCommands(string line);
	CommandsFileTextFormat * fileFormat;


};

} /* namespace TextFileParserSpace */

#endif /* COMMANDSTEXTFILEPARSER_H_ */
